package view;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import util.Popular;

public class ViewPopularSistema extends JFrame implements ActionListener{

	private JPanel contentPane;
	private JButton btnPopular;
	private JButton btnVazio;

	public ViewPopularSistema() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(null);
		
		btnPopular = new JButton("Popular");
		btnPopular.addActionListener(this);
		btnPopular.setFont(new Font("Tahoma", Font.PLAIN, 15));
		btnPopular.setBounds(136, 60, 118, 50);
		panel.add(btnPopular);
		
		btnVazio = new JButton("Vazio");
		btnVazio.addActionListener(this);
		btnVazio.setFont(new Font("Tahoma", Font.PLAIN, 15));
		btnVazio.setBounds(136, 123, 118, 50);
		panel.add(btnVazio);
	}

	public void actionPerformed(ActionEvent e) {
		JComponent elemento = (JComponent) e.getSource();
		if(elemento.equals(btnPopular)){
			Popular popular = new Popular();
			popular.executar();
		}
		else if(elemento.equals(btnVazio)){
			
		}
		this.dispose();
		ViewTelaPrincipal view = new ViewTelaPrincipal();
		view.setVisible(true);
	}
}
